﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace orderCreater.ben
{
    public partial class FormDetail : Form
    {
        public FormDetail()
        {
            InitializeComponent();
        }
        public void SetWebBrowserUrl(string url)
        {
            webBrowser2.Navigate(url);
        }
        private void webBrowser2_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            foreach (HtmlElement div in webBrowser2.Document.GetElementsByTagName("div"))
            {
                if (div.GetAttribute("className").IndexOf("p-trade-slips") >= 0)
                {
                    foreach (HtmlElement th in div.GetElementsByTagName("th"))
                    {
                        if (th.InnerText != null)
                        {
                            if (th.InnerText == "对方信息：")
                            {
                                foreach (HtmlElement td in th.Parent.GetElementsByTagName("td"))
                                {
                                    //LogHelper.Debug(td.OuterHtml);
                                    if (td.InnerText != null)
                                    {
                                        string itext = td.InnerText;
                                        LogHelper.Debug(itext.Substring(0, itext.IndexOf("| 订阅该服务商")));
                                    }
                                }
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
}
